﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZhongheCms.Models;

namespace ZhongheCms.Controllers
{
    public class FeedbackController : Controller
    {
        //
        // GET: /Feedback/

        public ActionResult WebSite(int id = 0, string m = "", string f = "", string p = "", string fid = "", string sdate = "", string edate = "", string keywords = "")
        {
            ViewBag.m = m;
            ViewBag.f = f;
            ViewBag.p = p;
            ViewBag.fid = fid;
            ViewBag.keywords = keywords;
            ViewBag.sdate = sdate;
            ViewBag.edate = edate;
            if (GswTblUser.CurrentUser == null)
                return RedirectToAction("Login", "Account");
            GswTblUser.CurrentUser.ModuleName = m;
            GswTblUser.CurrentUser.FuncName = f;
            var news = GswTblMsg.GetMsgList(sdate, edate, keywords, fid, GswTblUser.CurrentUser.CustomerId);

            return View(news);
        }
        public ActionResult Products(int id = 0, string m = "", string f = "", string p = "", string fid = "", string sdate = "", string edate = "", string keywords = "")
        {
            ViewBag.m = m;
            ViewBag.f = f;
            ViewBag.p = p;
            ViewBag.fid = fid;
            ViewBag.keywords = keywords;
            ViewBag.sdate = sdate;
            ViewBag.edate = edate;
            if (GswTblUser.CurrentUser == null)
                return RedirectToAction("Login", "Account");
            GswTblUser.CurrentUser.ModuleName = m;
            GswTblUser.CurrentUser.FuncName = f;
            var news = GswTblMsg.GetMsgList(sdate, edate, keywords, fid, GswTblUser.CurrentUser.CustomerId);

            return View(news);
        }
        public ActionResult WebSiteDelete(int id, string m = "", string f = "", string p = "", string fid = "", string sdate = "", string edate = "", string keywords = "")
        {
            ViewBag.m = m;
            ViewBag.f = f;
            ViewBag.p = p;
            ViewBag.fid = fid;
            ViewBag.keywords = keywords;
            ViewBag.sdate = sdate;
            ViewBag.edate = edate;
            if (GswTblUser.CurrentUser == null)
                return RedirectToAction("Login", "Account");
            GswTblUser.CurrentUser.ModuleName = m;
            GswTblUser.CurrentUser.FuncName = f;
            GswTblMsg.Delete("WHERE Id=" + id);
            var qry = GswTblMsg.GetMsgList(sdate, edate, keywords, fid, GswTblUser.CurrentUser.CustomerId);

            return View("WebSite", qry);
        }
        public ActionResult ProductsDelete(int id, string m = "", string f = "", string p = "", string fid = "", string sdate = "", string edate = "", string keywords = "")
        {
            ViewBag.m = m;
            ViewBag.f = f;
            ViewBag.p = p;
            ViewBag.fid = fid;
            ViewBag.keywords = keywords;
            ViewBag.sdate = sdate;
            ViewBag.edate = edate;
            if (GswTblUser.CurrentUser == null)
                return RedirectToAction("Login", "Account");
            GswTblUser.CurrentUser.ModuleName = m;
            GswTblUser.CurrentUser.FuncName = f;
            GswTblMsg.Delete("WHERE Id=" + id);
            var qry = GswTblMsg.GetMsgList(sdate, edate, keywords, fid, GswTblUser.CurrentUser.CustomerId);

            return View("Products", qry);
        }
    }
}
